package coms;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;


public class ClientTester {
	public static void main(String[] args) throws UnknownHostException, IOException  {
		/**
		 * This code demonstrates how the client might work. It should be started after
		 * the ServerTest code.
		 */
		ConnectingClient client = null;
	


		client = new ConnectingClient(InetAddress.getByName("127.0.0.1"), 5001);
		BufferedReader myBuffReader = client.getBufferedReader();
		
		int i = 0;
		while (client.isConnected()) {
			client.writeToSocket("snart, sa hesten " + i + '\n');
			i++;
			if (i > 15) {
				client.closeConnection();
				client.mySocket.close();
			}
		}
		
		
	}


}